Fix gtk_tree_view_column_cell_get_position()
authorKristian Rietveld <kris@gtk.org>
Fri, 7 Jan 2011 14:10:06 +0000 (15:10 +0100)
committerKristian Rietveld <kris@gtk.org>
Fri, 7 Jan 2011 14:38:06 +0000 (15:38 +0100)
gtk/gtktreeviewcolumn.c

index 00a2ea7499ee66ec9ce0005c6d29d3b3e8afdc4e..612732f5499f73b9f1e2c5a29d976ebfd301a568 100644 (file)
@@ -2972,7 +2972,7 @@ gtk_tree_view_column_cell_get_position (GtkTreeViewColumn *tree_column,
                                        gint              *width)
 {
   GtkTreeViewColumnPrivate *priv;
-  GdkRectangle zero_cell_area = { 0, };
+  GdkRectangle cell_area;
   GdkRectangle allocation;
 
   g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), FALSE);
@@ -2980,16 +2980,24 @@ gtk_tree_view_column_cell_get_position (GtkTreeViewColumn *tree_column,
 
   priv = tree_column->priv;
 
-  /* FIXME: Could use a boolean return value for invalid cells */
+  gtk_tree_view_get_background_area (GTK_TREE_VIEW (priv->tree_view),
+                                     NULL, tree_column, &cell_area);
+
   gtk_cell_area_get_cell_allocation (priv->cell_area,
                                      priv->cell_area_context,
                                      priv->tree_view,
                                      cell_renderer,
-                                     &zero_cell_area,
+                                     &cell_area,
                                      &allocation);
 
   if (x_offset)
-    *x_offset = allocation.x;
+    {
+      GdkRectangle button_allocation;
+
+      /* Retrieve column offset */
+      gtk_widget_get_allocation (priv->button, &button_allocation);
+      *x_offset = allocation.x - button_allocation.x;
+    }
   if (width)
     *width = allocation.width;